// const mockAxios: any = jest.genMockFromModule('axios');
const mockAxios = {}

mockAxios.get = jest.fn(() => Promise.resolve({ data: {} }))
mockAxios.post = jest.fn(() => Promise.resolve({ data: {} }))
mockAxios.put = jest.fn(() => Promise.resolve({ data: {} }))
mockAxios.delete = jest.fn(() => Promise.resolve({ data: {} }))
mockAxios.all = jest.fn(() => Promise.resolve())
// this is the key to fix the axios.create() undefined error!
// mockAxios.create = jest.fn(() => mockAxios)
mockAxios.create = jest.fn(() => {
  return {
    interceptors: {
      request: { use: jest.fn(() => jest.fn()), eject: jest.fn(() => jest.fn()) },
      response: { use: jest.fn(() => jest.fn()), eject: jest.fn(() => jest.fn()) }
    }
  }
})
export default mockAxios
